package com.zjjk.transfer.app;

import cn.hutool.extra.pinyin.PinyinUtil;
import com.zjjk.transfer.source.entity.SourceDataDictionary;
import com.zjjk.transfer.source.service.SourceDataDictionaryService;
import com.zjjk.transfer.target.entity.TargetDataDictionary;
import com.zjjk.transfer.target.service.TargetDataDictionaryService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;

@Component
public class DataDictionaryTransfer extends BaseTransfer<SourceDataDictionary,TargetDataDictionary,SourceDataDictionaryService,TargetDataDictionaryService>{
    
    @Override
    protected TargetDataDictionary convert(SourceDataDictionary source) {
        TargetDataDictionary target = new TargetDataDictionary();
        BeanUtils.copyProperties(source, target);
        target.setId(source.getId());
        target.setSortPinyin(PinyinUtil.getFirstLetter(source.getValue(), ""));
        return target;
    }
}
